/* -----------------------------------------------------------------------
 * Unit Test 1 - Testing getCost
 * CS362
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <stdio.h>
#include <assert.h>

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

void testGetCost() {
    printf("TESTING getCost():\n");
    int i;
    char cardList[] = {curse, estate, duchy, province, copper, silver, gold, adventurer, council_room, feast, gardens, 
        mine, remodel, smithy, village, baron, great_hall, minion, steward, tribute, ambassador, cutpurse, 
        embargo, outpost, salvager, sea_hag, treasure_map};
    int cardCost[] = {0, 2, 5, 8, 0, 3, 6, 6, 5, 4, 4, 5, 4, 4, 3, 4, 3, 5, 3, 5, 3, 4, 2, 5, 4, 4, 4};

    for (i = 0; i < (sizeof(cardList) / sizeof(cardList[i])); i++) {
#if (NOISY_TEST == 1)
        printf("Card %d coded with cost %d, expected cost %d\n", cardList[i], getCost(cardList[i]), cardList[i]);
#endif
        if (getCost(cardList[i])  == cardCost[i]) 
            assert(getCost(cardList[i]) == cardCost[i]);
        else
            printf("getCost() failed for card: %d\n", cardList[i]);
    }
   
    printf("All tests passed!\n");
}


int main() {
    testGetCost();
    return 0;
}
